package cn.itsource.hrm.fallback;

import cn.itsource.hrm.client.SearchFeign;
import cn.itsource.hrm.document.CourseDoc;
import cn.itsource.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;


@Slf4j
@Component
//@Controller
//@Service
//@Repository
public class SearchFeignFactory implements FallbackFactory<SearchFeign> {
    
    @Override
    public SearchFeign create(Throwable throwable) {
        
       return new SearchFeign() {
            @Override
            public AjaxResult onLineCourse(CourseDoc doc) {
                throwable.printStackTrace();
                log.error("参数："+doc);
                return AjaxResult.me().setSuccess(false).setMessage("ES保存失败！");
            }
        };

    }
}
